//
//  TestModel.swift
//  DYSwiftFramework
//
//  Created by huangdeyu on 2021/11/2.
//  Copyright © 2021 none. All rights reserved.
//

import Foundation


class Root {

    var code: Int?
    var tdata: Tdata?
    var success: Bool?

    required init?(json:[String:Any?]?) {
        if json == nil {return nil}
        code = json?["code"] as? Int
        success = json?["success"] as? Bool
        if let tdata_tmp = json?["tdata"] as? [String:Any?] {
            tdata = Tdata.init(json:tdata_tmp)
        }
    }

}

class Tdata {

    var voiceOpinions: [VoiceOpinions]?
    var test: Int?

    required init?(json:[String:Any?]?) {
        if json == nil {return nil}
        test = json?["test"] as? Int
        if let value = json?["voice_opinions"]  as? [[String:Any?]]{
            voiceOpinions = [VoiceOpinions]()
             value.forEach { (item) in
                 if let i = VoiceOpinions.init(json:item) {
                     voiceOpinions?.append(i)
                 }
            }
        }
    }

}

class VoiceOpinions {

    var uniqueId: String?
    var createdAt: Int?
    var updateAt: Int?
    var userId: Int?
    var id: Int?
    var counterOpinions: [CounterOpinions]?
    var hotTopicId: Int?
    var audioId: Int?
    var vote: Int?
    var status: Int?

    required init?(json:[String:Any?]?) {
        if json == nil {return nil}
        uniqueId = json?["unique_id"] as? String
        createdAt = json?["createdAt"] as? Int
        updateAt = json?["updateAt"] as? Int
        userId = json?["user_id"] as? Int
        id = json?["id"] as? Int
        hotTopicId = json?["hot_topic_id"] as? Int
        audioId = json?["audio_id"] as? Int
        vote = json?["vote"] as? Int
        status = json?["status"] as? Int
        if let value = json?["counter_opinions"]  as? [[String:Any?]]{
            counterOpinions = [CounterOpinions]()
             value.forEach { (item) in
                 if let i = CounterOpinions.init(json:item) {
                     counterOpinions?.append(i)
                 }
            }
        }
    }

}

class CounterOpinions {

    var hotTopicId: Int?
    var createdAt: Int?
    var userId: Int?
    var status: Int?
    var id: Int?
    var audioId: Int?
    var updateAt: Int?
    var vote: Int?
    var uniqueId: String?

    required init?(json:[String:Any?]?) {
        if json == nil {return nil}
        hotTopicId = json?["hot_topic_id"] as? Int
        createdAt = json?["createdAt"] as? Int
        userId = json?["user_id"] as? Int
        status = json?["status"] as? Int
        id = json?["id"] as? Int
        audioId = json?["audio_id"] as? Int
        updateAt = json?["updateAt"] as? Int
        vote = json?["vote"] as? Int
        uniqueId = json?["unique_id"] as? String
    }

}
